package com.corpgovernment.organization.service.impl;

import com.corpgovernment.api.basic.vo.MbUserLoginRecordVo;
import com.corpgovernment.organization.entity.db.MbUserLoginRecord;
import com.corpgovernment.organization.mapper.MbUserLoginRecordMapper;
import com.corpgovernment.organization.service.IUserLoginRecordService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 用户登录记录service
 *
 * @author jhxue
 */
@Service
public class UserLoginRecordServiceImpl implements IUserLoginRecordService {

	@Autowired
	private MbUserLoginRecordMapper mbUserLoginRecordMapper;

	@Override
	public void insert(MbUserLoginRecordVo model) {
		mbUserLoginRecordMapper.insertSelective(this.convert(model));
	}

	/**
	 * 数据类型转换
	 *
	 * @param source
	 * @return
	 */
	private MbUserLoginRecord convert(MbUserLoginRecordVo source) {
		if (source == null) {
			return null;
		}
		MbUserLoginRecord target = new MbUserLoginRecord();
		BeanUtils.copyProperties(source, target);
		return target;
	}

}
